package com.cenwangkeji.resident.model.bean;

import android.content.Context;
import android.text.TextUtils;

import com.cenwangkeji.resident.MyApp;
import com.cenwangkeji.resident.R;
import com.cenwangkeji.resident.model.Constant;
import com.lws.basic.utils.common.SharePreferenceUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @松 on 2019/10/28 14:03
 */
public class User {
    public static String getToken(){
        String token = SharePreferenceUtils.getString(MyApp.getContext(), Constant.token, "");
        return token;
    }

    public static int getUserId(){
        int id = SharePreferenceUtils.getInt(MyApp.getContext(), Constant.user_id, 0);
        return id;
    }

    //过去属于医生id
    public static int getDoctorId(){
        int id = SharePreferenceUtils.getInt(MyApp.getContext(), Constant.doctor_id, 0);
        return id;
    }

    //返回数值对应的民族
    public static String getNation(int num){
        String[] strings = MyApp.getContext().getResources().getStringArray(R.array.nation);
        String nation="";
        for (int i= 0; i< strings.length ; i++){
              if (strings[i].contains(num+"")){
                  nation = strings[i];
                  break;
              }
        }
        nation = nation.substring(1);//
        return nation;
    }
    //8,9,10,11,12 返回list
    public static List<String> numList(String s){
        List<String> list = new ArrayList<>();
        if (!TextUtils.isEmpty(s) && s.length()>0){
            String[] ss = s.split(",");
            for (int i=0;i < ss.length ;i++){
                list.add(ss[i]);
            }
        }
        return list;
    }


}
